Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add field arithmetic skeleton #7

Merged
merged 3 commits into from
Apr 9, 2019
Merged

Add field arithmetic skeleton #7

merged 3 commits into from
Apr 9, 2019

Conversation

hdevalence
Copy link
Contributor

This doesn't yet fill in the implementations, so it won't run, but it means that it's possible to start using the api with cargo check. Progress on #1 to unblock other issues.

This defines (but does not implement):

* conversion to and from the curve25519-dalek packed `Scalar` type;
* addition;
* subtraction;
* multiplication;
* zero & one constructors and Default;
* inversion;

The implementation in curve25519-dalek allows doing operations either in
Montgomery form or not in Montgomery form; I think that for this use-case, it
would be better to require that a `FieldElement` is *always* in Montgomery
form, so that the multiplication is always Montgomery multiplication.  We can
also probably save some time by allowing the representatives to lie in the
range [0, 2*l) instead of [0, l) as in the original implementation (cf. "Montgomery
Multiplication Needs No Final Subtractions").
@hdevalence hdevalence requested a review from cathieyun April 9, 2019 02:05
Copy link
Member

@cathieyun cathieyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hdevalence hdevalence merged commit ce61dd1 into master Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants